package com.nc.shop.service.controller;

import com.nc.shop.service.dao.ClassifyDao;
import com.nc.shop.service.model.entity.ClassifyEntity;
import com.nc.shop.service.service.ClassifyService;
import com.plug.result.ReqPage;
import com.plug.result.RetResponse;
import com.plug.result.RetResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 创建人:    xvzhe
 * 创建时间:
 * 修改时间:
 * 版本:      v1.0
 */
@RestController
@RequestMapping("ClassifyController")
@Api
public class ClassifyController {
    @Autowired
    ClassifyDao classifyDao;
    @Autowired
    ClassifyService classifyService;

    @ApiOperation("保存分类")
    @PostMapping("classify")
    public RetResult postClassify(@RequestBody ClassifyEntity classifyEntity) {
        classifyDao.save(classifyEntity);
        return RetResponse.makeOKRsp();
    }

    @GetMapping("getClassify")
    @ApiOperation("分类列表")
    public RetResult getClassify(ClassifyEntity classifyEntity){
        return classifyService.findPage(classifyEntity);
    }
}
